package cn.xuchunh.exam;

import java.util.Scanner;

/**
 * Created by XuChunH on 2016/9/10.
 */
public class FindIndex {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()){
            String target  = scanner.nextLine();
            int index = 0;
            int gap = 1 + 25 + 25 * 25 + 25 * 25 * 25;
            index  = (target.charAt(0) - 'a') * gap;
            for (int i = 1; i < target.length(); i++) {
                gap = 1;
                for (int j = 0; j < 3 - i; j++) {
                    gap = 1 + gap * 25;
                }
                index = index + (target.charAt(i)  - 'a') * gap + 1;
            }
            System.out.println(index);
        }
    }

}
